﻿Imports Entities
Imports DataAccess
Public Class CamionBL
    Public Shared Function List() As List(Of CAMIONES)
        Dim lista As New List(Of CAMIONES)
        lista = CamionDAL.List
        If lista.Count > 0 Then
            Return lista
        Else
            Return Nothing
        End If
    End Function
    Public Shared Function Save(ByVal zObject As CAMIONES) As Boolean
        If CamionDAL.Exist(zObject.PATENTE) Then
            zObject.ACTIVO = True
            CamionDAL.Update(zObject)
            Return True
        Else
            Return CamionDAL.Create(zObject)
        End If
    End Function

    Public Shared Function Delete(ByVal zId As String) As Boolean
        Return CamionDAL.Delete(zId)
    End Function

    Public Shared Function SearchById(ByVal zId As String) As CAMIONES
        Dim obj As New CAMIONES
        obj = CamionDAL.SearchById(zId)
        If Not IsNothing(obj) Then
            Return obj
        Else
            Return Nothing
        End If
    End Function


    Public Shared Function GetDescripcion(ByVal zId As String) As String
        Dim obj As New CAMIONES
        obj = CamionDAL.SearchById(zId)
        If Not IsNothing(obj) Then
            Return obj.DESCRIPCION
        Else
            Return ""
        End If
    End Function
    
End Class
